var t = getApp();

Page({
    data: {
        tabs: [ {
            name: "全部订单",
            status: -999,
            orderList: []
        }, {
            name: "待支付",
            status: 0,
            orderList: []
        }, {
            name: "待发货",
            status: 1,
            orderList: []
        }, {
            name: "待收货",
            status: 2,
            orderList: []
        }, {
            name: "已完成",
            status: 3,
            orderList: []
        }, {
            name: "售后中",
            status: 4,
            orderList: []
        } ],
        orderData: [],
        distinction: "teamOrder",
        isLoadMore: !0,
        page: 1,
        totalPage: 0,
        tabIndex: 0,
        starTime: null,
        endTime: null,
        status: -999,
        active: 0
    },
    onLoad: function(t) {
        var a, e, s;
        "" === (null !== (a = t.start_time) && void 0 !== a ? a : "") && "" === (null !== (e = t.end_time) && void 0 !== e ? e : "") || this.setData({
            starTime: Number(t.start_time),
            endTime: Number(t.end_time)
        }), "" !== (null !== (s = t.status) && void 0 !== s ? s : "") && this.setData({
            status: Number(t.status)
        }), this.statsData();
    },
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreData() : console.log("没有更多了");
    },
    onPullDownRefresh: function() {
        wx.showNavigationBarLoading(), wx.showLoading({
            title: "刷新中..."
        }), this.setData({
            page: 1
        }), this.statsData();
    },
    statsData: function() {
        var a = this, e = t.getNetAddresss("plugin.team-analysis.frontend.detail.orderDetail"), s = {
            start_time: this.data.starTime,
            end_time: this.data.endTime,
            page: this.data.page,
            status: this.data.status
        };
        console.log(e + ">>>>>"), t._getNetWork({
            url: e,
            data: s,
            success: function(t) {
                var e = t.data, s = e.data.data;
                wx.hideLoading(), wx.hideNavigationBarLoading(), wx.stopPullDownRefresh(), 1 == e.result ? (a.data.isLoadMore = !0, 
                a.data.totalPage = e.data.last_page, a.data.totalPage || (a.data.totalPage = 0), 
                a.setData({
                    orderData: s
                })) : (a.data.page = a.data.page - 1, a.isLoadMore = !1, wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getMoreData: function() {
        var a = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.totalPage)) {
            this.data.page = this.data.page + 1;
            var e = t.getNetAddresss("plugin.team-analysis.frontend.detail.orderDetail"), s = {
                start_time: this.data.starTime,
                end_time: this.data.endTime,
                page: this.data.page,
                status: this.data.status
            };
            console.log(e + ">>>>>"), t._getNetWork({
                url: e,
                data: s,
                success: function(t) {
                    var e = t.data, s = e.data.data;
                    1 == e.result ? (a.data.isLoadMore = !0, a.setData({
                        orderData: a.data.orderData.concat(s)
                    })) : (a.data.page = a.data.page - 1, a.isLoadMore = !1, wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    })), console.log(a.data.orderData);
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    },
    onChange: function(t) {
        this.setData({
            status: t.detail.name,
            page: 1
        }), this.statsData();
    },
    onSnCopy: function(t) {
        console.log(t);
        var a = t.currentTarget.dataset.numbers;
        wx.setClipboardData({
            data: a,
            success: function(t) {
                wx.showToast({
                    title: "复制成功"
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onShareAppMessage: function() {}
});